package com.chanyachting.emall.action.applicationLeter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.chanyachting.emall.domain.Jobhistory;
import com.chanyachting.emall.form.JobHistoryForm;
import com.chanyachting.emall.service.ApplicationLeterService;
import com.chanyachting.emall.serviceImpl.ApplicationLeterServiceImpl;
import com.chanyachting.emall.util.RequestUtil;

public class UpdateJobHistoryAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		JobHistoryForm jhForm=(JobHistoryForm)form;
		
		Jobhistory jh=new Jobhistory();
		
		BeanUtils.copyProperties(jh, jhForm);
		
		ApplicationLeterService alservice=new ApplicationLeterServiceImpl();
		
		boolean temp=alservice.updateJobHistory(jh);
		
		RequestUtil ru=new RequestUtil(request);
		
		if(temp) ru.setSuccessMsg(); else ru.setFailMsg();
		
		
		return mapping.findForward("");
	}
	
	
	

}
